def bubble_sort(nums):
    swapped = true
    while swapped:
        swapped = false
        for i in range(len(nums) - 1):
            if nums[i] > nums[i + 1]:
                nums[i], nums[i + 1] = nums[i + 1], nums[i]
                swapped = true
                
void bubbleSort(int list[], int listLength) {
        while(listLength--) {
                bool swapped = false;
                
                for(int i = 0; i < listLength; i++) {
                        if(list[i] > list[i + 1]){
                                swap(list[i], list[i + 1]);
                                swapped = true;
                        }
                }
                if(swapped == false) break;
        }
    }
    
def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data

m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")

void read_from_file(const char *filename, int a[], int length) {
    ifstream file(filename);
    
    for(int i=0; i < length; i++)
        file >> a[i];
}

    #define LEN 5000
    int a[LEN];
    
    read_from_file("m1_sorted.txt",a,LEN);
    
import time

t_start = time.time() // начальное время
t_finish = time.time() // конечное время
print("Время",round((t_finish-t_start)*1000))

#include <ctime>
unsigned int t_start = clock();
unsigned int t_finish = clock();
unsigned int t_work = t_finish - t_start;
cout<<"m1_sorted " << t_work << " milliseconds \n";
